using SharpDX.Direct3D11;
using System;

namespace Engine.Graphics.Shaders.Wr2Shaders
{
    public class MaterialColorShader : ShaderBase, ISetShaderValues
    {
        #region Private Fields

        private string name;

        #endregion Private Fields

        #region Public Constructors

        public MaterialColorShader(Device renderDevice, string shaderDirectory, ShaderManager shaderManager)
            : base(renderDevice, shaderManager)
        {
            try
            {
                this.name = shaderDirectory;
                Helpers.LogWriter.Write(0, "Load MaterialShader " + shaderDirectory);
                base.LoadShader(renderDevice, shaderDirectory + "\\MaterialColor.fx", "ps_main", "vs_main");
                Helpers.LogWriter.Write(0, "Load MaterialShader InputLayout");
                this.inputLayout = new InputLayout(renderDevice, this.shaderByteCodeVS, Graphics.VertexStructures.EngineVertexElements.elements);
            }
            catch (Exception ex)
            {
                Helpers.LogWriter.Write(100, "[Shader failed] MaterialColorShader" + shaderDirectory);
            }
        }

        #endregion Public Constructors

        #region Public Properties

        public ShaderBase Effect
        {
            get { return this.effect; }
        }

        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        #endregion Public Properties

        #region Public Methods

        public new void Dispose()
        {
            this.effect.Dispose();
        }

        public void SetProperties(int materialID, MaterialManager materialManager)
        {
            Material material = materialManager.GetMaterial(materialID);

            //ShaderBase.SetTexture(0, materialManager.Textures[materialManager.GetTextureIDTexture1(materialID)], base.Device);
            // base.SetUvMatrix1(material);
        }

        #endregion Public Methods
    }
}